package com.woniuxy.Service.impl;

import com.woniuxy.Service.UserService;
import com.woniuxy.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired//通过注解进行自动装配，默认先使用的是byType进行装配
    UserDao userDao;

    @Override

    public List<Map<String, String>> findAll() {
        Map<String, String> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("account","test");
        userDao.insert(objectObjectHashMap);
        return  userDao.findAll();
    }

    @Override
    public void updateOne() {
        Map<Object, Object> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("account","updateName");
        objectObjectHashMap.put("id","21");
        userDao.updateOne(objectObjectHashMap);
        int i = 1/0;
    }
}
